(Assumes both inputs are fixed.)

(Feel free to skip this if another submission also caches the result.)